/*
* Copyright (c) 2010-2013 Ruben Chakhmakhchyan. All rights reserved.
* 
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Eclipse Public License
* Version 1.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://opensource.org/licenses/EPL-1.0 and read it before using this file.
*/

#include "plugin_impl.h"
#include <UrlMon.h>


_Plugin::_Plugin( CScriptableControl* pControl )
    : m_model( NULL ),
    m_scriptableControl( pControl ),
    m_userAgent( NULL )
{
    ::CreatePluginModel( this, this );

    // get user agent
    DWORD cbSize = 512;
    CHAR cszUAOut[ 512 ] = { 0 };
    HRESULT hResult = ::ObtainUserAgentString( 0, cszUAOut, &cbSize );
    if ( hResult == NOERROR )
    {
        cbSize++;
        m_userAgent = new char[ cbSize ];
        ::memcpy( m_userAgent, cszUAOut, cbSize );
    }
}

_Plugin::~_Plugin()
{
    delete m_model;
    m_model = NULL;
}
